package com.ozo.easy.gen.pojo.dto;

import com.ozo.easy.gen.constant.PageFormOpenType;
import com.ozo.easy.gen.constant.PageFormType;
import com.ozo.easy.gen.constant.PageTableType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 数据库表详情对象
 * </p>
 *
 * @author ozo
 * @date 2025-01-06
 */
@Schema(description = "数据库表详情对象")
@Data
public class GenTableDetailDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "id不能为空")
    @Schema(description = "id")
    private Long id;

    @Pattern(regexp = "^[a-z0-9_]+$", message = "表名只能为小写英文字母、数字和_")
    @NotBlank(message = "表名不能为空")
    @Schema(description = "表名")
    private String tableName;

    @Schema(description = "表注释")
    private String tableComment;

    @Schema(description = "是否继承基类")
    private Boolean extendBaseEntity = false;

    @NotBlank(message = "项目名不能为空")
    @Schema(description = "项目名")
    private String projectName;

    @NotBlank(message = "生成作者不能为空")
    @Schema(description = "生成作者")
    private String genAuthor;

    @NotBlank(message = "生成版本号不能为空")
    @Schema(description = "生成版本号")
    private String genVersion;

    @NotBlank(message = "生成包路径不能为空")
    @Schema(description = "生成包路径")
    private String genPackage;

    @NotBlank(message = "生成实体类名不能为空")
    @Schema(description = "生成实体类名")
    private String genClass;

    @NotBlank(message = "生成功能描述不能为空")
    @Schema(description = "生成功能描述")
    private String genFunction;

    @Schema(description = "生成日志")
    private Boolean genOperateLog = true;

    @Schema(description = "生成新增")
    private Boolean genAdd = false;

    @Schema(description = "生成删除")
    private Boolean genRemove = false;

    @Schema(description = "生成编辑")
    private Boolean genEdit = false;

    @Schema(description = "生成查询")
    private Boolean genSelect = false;

    @Schema(description = "生成页面")
    private Boolean genPage = false;

    @NotNull(message = "生成页面表格类型不能为空")
    @Schema(description = "生成页面表格类型")
    private PageTableType genPageTableType;

    @NotNull(message = "生成页面表单类型不能为空")
    @Schema(description = "生成页面表单类型")
    private PageFormType genPageFormType;

    @NotNull(message = "生成页面表单打开类型不能为空")
    @Schema(description = "生成页面表单打开类型")
    private PageFormOpenType genPageFormOpenType;

    @NotBlank(message = "生成路径不能为空")
    @Schema(description = "生成路径")
    private String genPath;

    @Schema(description = "上级菜单id")
    private Long parentMenuId;

    @Schema(description = "备注")
    private String remark;

    @Valid
    @NotEmpty(message = "表字段配置不能为空")
    @Schema(description = "表字段配置")
    private List<GenTableColumnDetailDTO> columnList;

}
